home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / dev / scott / WWW / NextStep / Implementation / old / HTTCP.h < prev    next >
C/C++ Source or Header  |  1991-09-11  |  2KB  |  95 lines

  1. /*            Generic Communication Code        HTTCP.h
  2. **            ==========================
  3. **
  4. **    Requires tcp.h to be included first.
  5. */
  6. #ifdef SHORT_NAMES
  7. #define HTInetStatus            HTInStat
  8. #define HTInetString         HTInStri
  9. #define HTParseInet        HTPaInet
  10. #endif
  11.  
  12. /*    Produce a string for an internet address
  13. **    ---------------------------------------
  14. **
  15. ** On exit,
  16. **    returns    a pointer to a static string which must be copied if
  17. **        it is to be kept.
  18. */
  19. #ifdef __STDC__
  20. extern const char * HTInetString(struct sockaddr_in* sin);
  21. #else
  22. extern char * HTInetString();
  23. #endif
  24.  
  25.  
  26. /*    Encode INET status (as in sys/errno.h)              inet_status()
  27. **    ------------------
  28. **
  29. ** On entry,
  30. **    where        gives a description of what caused the error
  31. **    global errno    gives the error number in the unix way.
  32. **
  33. ** On return,
  34. **    returns        a negative status in the unix way.
  35. */
  36. #ifdef __STDC__
  37. extern int HTInetStatus(char *where);
  38. #else
  39. extern int HTInetStatus();
  40. #endif
  41.  
  42. /*    Publicly accesible variables
  43. */
  44. extern struct sockaddr_in HTHostAddress;/* The internet address of the host */
  45.                     /* Valid after call to HTHostName() */
  46.  
  47. /*    Parse a cardinal value                       parse_cardinal()
  48. **    ----------------------
  49. **
  50. ** On entry,
  51. **    *pp        points to first character to be interpreted, terminated by
  52. **            non 0:9 character.
  53. **    *pstatus    points to status already valid
  54. **    maxvalue    gives the largest allowable value.
  55. **
  56. ** On exit,
  57. **    *pp        points to first unread character
  58. **    *pstatus    points to status updated iff bad
  59. */
  60. #ifdef __STDC__
  61. extern unsigned int HTCardinal(int *pstatus,
  62.     char        **pp,
  63.     unsigned int    max_value);
  64. #else
  65. extern unsigned int HTCardinal();
  66. #endif
  67.  
  68. /*    Parse an internet node address and port
  69. **    ---------------------------------------
  70. **
  71. ** On entry,
  72. **    str    points to a string with a node name or number,
  73. **        with optional trailing colon and port number.
  74. **    sin    points to the binary internet address field.
  75. **
  76. ** On exit,
  77. **    *sin    is filled in. If no port is specified in str, that
  78. **        field is left unchanged in *sin.
  79. */
  80. #ifdef __STDC__
  81. extern int HTParseInet(struct sockaddr_in* sin, const char *str);
  82. #else
  83. extern int HTParseInet();
  84. #endif
  85.  
  86. /*    Get Name of This Machine
  87. **    ------------------------
  88. **
  89. */
  90. #ifdef __STDC__
  91. extern const char * HTHostName(void);
  92. #else
  93. extern char * HTHostName();
  94. #endif
  95.